package com.shanzmoo.db.module.psys.domain.vo;

import com.alibaba.fastjson.JSON;
import com.shanzmoo.db.module.msys.entity.MSysMenuEntity;
import com.shanzmoo.db.module.psys.entity.PSysMenuEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * 菜单列表返回对象
 *
 * @author Gzhao
 * @date 2020/11/17
 */
@Data
@Accessors(chain = true)
@ApiModel("菜单列表返回对象")
public class MenuVO {

    @ApiModelProperty("菜单Id" )
    private Integer menuId;

    @ApiModelProperty("菜单名称" )
    private String menuName;

    @ApiModelProperty("前端路由地址" )
    private String routerUrl;

    @ApiModelProperty("前端组件路径" )
    private String componentPath;

    @ApiModelProperty("权限标识" )
    private String perms;

    @ApiModelProperty("排序号" )
    private Integer menuIndex;

    @ApiModelProperty("父级菜单" )
    private Integer parentId;

    @ApiModelProperty("子菜单" )
    private List<MenuVO> children;

    @ApiModelProperty("是否被选中" )
    private Boolean selected = false;

    private String routerName;
    private String redirectUrl;
    private Boolean status;
    private String param;
    /*public static MenuVo create(MenuEntity menuEntity) {
        return JSON.parseObject(JSON.toJSONString(menuEntity), MenuVo.class);
    }*/

    public static MenuVO pSysCreate(PSysMenuEntity menuEntity) {
        return JSON.parseObject(JSON.toJSONString(menuEntity), MenuVO.class);
    }
    public static MenuVO mSysCreate(MSysMenuEntity menuEntity) {
        return JSON.parseObject(JSON.toJSONString(menuEntity), MenuVO.class);
    }
}
